<?php
include "include/config.inc.php";
$partyId = $_REQUEST['partyId'];
$checkActiveLoan = " SELECT partyName,address 
                       FROM party
                       JOIN loan ON party.partyId = loan.partyId
                       JOIN installment ON loan.loanId = installment.loanId
                      WHERE party.partyId = '".$partyId."' 
                        AND installment.isReceived = 'N'";
$checkActiveLoanRes = mysql_query($checkActiveLoan);
$checkActiveLoanRow = mysql_fetch_array($checkActiveLoanRes);
$checkActiveLoanNoRow = mysql_num_rows($checkActiveLoanRes);
if($checkActiveLoanNoRow > 0 )
{
  $msg = "loan is panding for this party";
  header("location:displayClient.php?msg=".$msg);
}
else
{
  $updateParty = " UPDATE party 
                      SET partyStatus = 'Deactive'
                    WHERE partyId =".$partyId;
 mysql_query($updateParty);
 header("location:displayClient.php");
}

?>